package main

import (
	"log"
	"feedfinder"
	"os"
	"text/template"
)

func main() {
	url := os.Args[1]

	m, err := feedfinder.Feed(url)
	if err != nil {
		log.Fatalln(err)
	}

	s, err := feedfinder.FetchStories(m)
	if err != nil {
		log.Fatalln(err)
	}

	t := template.Must(template.New("feed").Parse(feed))
	for _, v := range s {
		err := t.Execute(os.Stdout, v)
		if err != nil {
			log.Fatalln(err)
		}
	}
}	

const feed = `
{{.Title}}
	{{.Feed}}
	{{.Date}}
	{{.Link}}

	{{.Summary}}
`
	
	
